﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SCS.Web.UI.WebControls.Dialogs
{
    public class ClientState
    {
        public bool Show
        {
            get;
            set;
        }

        public virtual string SerializeToJson()
        {
            return string.Format(@"""show"":{0}", Show.ToString().ToLower());
        }

        public virtual void DerializeFromJson(string json)
        {
            json = json.Replace("{", "").Replace("}", "");

            string[] data = json.Split(',');

            foreach (string s in data)
            {
                string[] pair = s.Split(':');

                if (pair[0].Contains("show"))
                    Show = Convert.ToBoolean(pair[1]);
            }
        }
    }
}
